package com.ruoyi.web.controller.order;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.order.domain.OrderFulfillInfo;
import com.ruoyi.order.service.IOrderFulfillInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 移动点餐信息Controller
 *
 * @author HHAOYU
 * @date 2021-01-16
 */
@RestController
@RequestMapping("/order/orderFulfillInfo")
public class OrderFulfillInfoController extends BaseController
{
    @Autowired
    private IOrderFulfillInfoService orderFulfillInfoService;

    /**
     * 查询移动点餐信息列表
     */
    @PreAuthorize("@ss.hasPermi('cinema:orderFulfillInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(OrderFulfillInfo orderFulfillInfo)
    {
        startPage();
        List<OrderFulfillInfo> list = orderFulfillInfoService.selectOrderFulfillInfoList(orderFulfillInfo);
        return getDataTable(list);
    }

    /**
     * 导出移动点餐信息列表
     */
    @PreAuthorize("@ss.hasPermi('cinema:orderFulfillInfo:export')")
    @Log(title = "移动点餐信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(OrderFulfillInfo orderFulfillInfo)
    {
        List<OrderFulfillInfo> list = orderFulfillInfoService.selectOrderFulfillInfoList(orderFulfillInfo);
        ExcelUtil<OrderFulfillInfo> util = new ExcelUtil<OrderFulfillInfo>(OrderFulfillInfo.class);
        return util.exportExcel(list, "orderFulfillInfo");
    }

    /**
     * 获取移动点餐信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('cinema:orderFulfillInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(orderFulfillInfoService.selectOrderFulfillInfoById(id));
    }

    /**
     * 新增移动点餐信息
     */
    @PreAuthorize("@ss.hasPermi('cinema:orderFulfillInfo:add')")
    @Log(title = "移动点餐信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OrderFulfillInfo orderFulfillInfo)
    {
        return toAjax(orderFulfillInfoService.insertOrderFulfillInfo(orderFulfillInfo));
    }

    /**
     * 修改移动点餐信息
     */
    @PreAuthorize("@ss.hasPermi('cinema:orderFulfillInfo:edit')")
    @Log(title = "移动点餐信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OrderFulfillInfo orderFulfillInfo)
    {
        return toAjax(orderFulfillInfoService.updateOrderFulfillInfo(orderFulfillInfo));
    }

    /**
     * 删除移动点餐信息
     */
    @PreAuthorize("@ss.hasPermi('cinema:orderFulfillInfo:remove')")
    @Log(title = "移动点餐信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(orderFulfillInfoService.deleteOrderFulfillInfoByIds(ids));
    }
}
